package com.doyled.jump.menuitem;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;
import java.awt.image.BufferedImage;

import javax.swing.JButton;

import com.doyled.jump.framework.ResourceManager;

public class ExitButton extends JButton {

	private BufferedImage buttonImage;
	private BufferedImage buttonHoverImage;
	private Dimension size;

	public ExitButton() {
		buttonImage = ResourceManager.getInstance().getExitButtonImage();
		buttonHoverImage = ResourceManager.getInstance()
				.getExitButtonHoverImage();
		setMinimumSize(new Dimension(160, 40));
		setPreferredSize(new Dimension(160, 40));
		setContentAreaFilled(false);
		setBorderPainted(false);
	}

	@Override
	public void paint(Graphics g) {
		size = getPreferredSize();
		Image drawImage = null;
		if (getModel().isRollover()) {
			drawImage = buttonHoverImage;
		} else {
			drawImage = buttonImage;
		}
		g.drawImage(drawImage, 0, 0, (int)size.getWidth(), (int)size.getHeight(), 0, 0, buttonImage.getWidth(), buttonImage.getHeight(), this);
		super.paint(g);
	}

}
